package org.xhy.retryer.predicate;

import java.util.List;
import java.util.function.Predicate;

/**
 * @description:
 * @gitee: https://gitee.com/XhyQAQ
 * @copyright: B站: https://space.bilibili.com/152686439
 * @Author: Xhy
 * @CreateTime: 2024-04-29 22:26
 */
public class OrPredicate implements IPredicate{

    private final List<Predicate> predicates;

    public OrPredicate(List<Predicate> predicates){
        this.predicates= predicates;
    }
    @Override
    public boolean apply(Object input) {
        for (Predicate predicate : predicates) {
            if (((IPredicate)predicate).apply(input)) {
                return true;
            }
        }
        return false;
    }
}
